home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / lists / mint / l_0799 / 645 < prev    next >
Encoding:
Internet Message Format  |  1994-08-27  |  1.9 KB

  1. From: Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
  2. Date: Fri, 12 Nov 93 12:47:40 +0100
  3. Message-Id: <9311121147.AA05166@issan.informatik.uni-dortmund.de>
  4. To: mint@atari.archive.umich.edu
  5. Subject: Extension to MiNT 1.09
  6.  
  7. This patch implements a new command for the config file:
  8.  
  9. include filename
  10.  
  11. The purpose should be obvious :-)
  12.  
  13. It always annoyed be that i had to change many files if i want to
  14. change the configuration of mint. Now i have a single file for the
  15. common setup and various mint.cnf for testing.
  16.  
  17. --- orig/main.c    Fri Aug  6 17:58:20 1993
  18. +++ main.c    Thu Nov 11 20:35:02 1993
  19. @@ -22,6 +22,7 @@
  20.  static void init_intr P_((void));
  21.  static long getmch P_((void));
  22.  static void do_line P_((char *));
  23. +static void do_file P_((int));
  24.  static void shutmedown P_((PROC *));
  25.  void shutdown P_((void));
  26.  static void doset P_((char *,char *));
  27. @@ -1347,6 +1348,18 @@
  28.          *env_ptr = 0;
  29.          return;
  30.      }
  31. +    if (!strcmp (cmd, "include"))
  32. +      {
  33. +        int fd = f_open (arg1, 0);
  34. +        if (fd < 0)
  35. +          {
  36. +        ALERT ("include: cannot open file %s", arg1);
  37. +        return;
  38. +          }
  39. +        do_file (fd);
  40. +        f_close (fd);
  41. +        return;
  42. +      }
  43.  
  44.      arg2 = line;
  45.      while (*line && *line != ' ') line++;
  46. @@ -1395,22 +1408,15 @@
  47.  #define BUF 512
  48.  #define LINE 256
  49.  
  50. -void
  51. -load_config()
  52. +static void
  53. +do_file (fd)
  54. +     int fd;
  55.  {
  56. -    int fd;
  57.      long r;
  58.      char buf[BUF+1], c;
  59.      char line[LINE+1];
  60.      char *from;
  61.      int count = 0;
  62. -
  63. -    fd = (int) f_open("mint.cnf", 0);
  64. -    if (fd < 0)
  65. -        fd = (int) f_open("\\mint\\mint.cnf", 0);
  66. -    if (fd < 0)
  67. -        fd = (int) f_open("\\multitos\\mint.cnf", 0);
  68. -    if (fd < 0) return;
  69.      buf[BUF] = 0;
  70.      from = &buf[BUF];
  71.      line[LINE] = 0;
  72. @@ -1438,6 +1444,20 @@
  73.          line[count] = 0;
  74.          do_line(line);
  75.      }
  76. +}
  77. +
  78. +void
  79. +load_config()
  80. +{
  81. +    int fd;
  82. +
  83. +    fd = (int) f_open("mint.cnf", 0);
  84. +    if (fd < 0)
  85. +        fd = (int) f_open("\\mint\\mint.cnf", 0);
  86. +    if (fd < 0)
  87. +        fd = (int) f_open("\\multitos\\mint.cnf", 0);
  88. +    if (fd < 0) return;
  89. +    do_file (fd);
  90.      f_close(fd);
  91.  }
  92.  
  93.